from datetime import datetime

from django.db import models

# Create your models here.
from rest_framework.authtoken.admin import User


class Project(models.Model):
    name = models.CharField(default='', max_length=30, verbose_name='项目', help_text='项目名')
    url = models.CharField(max_length=30, verbose_name='二维码链接', help_text='二维码链接')

    # is_shown_current_point = models.BooleanField(default=True, verbose_name='是否显示当前分数')
    status = models.IntegerField(default=0, verbose_name='项目状态')

    has_need_to_know = models.BooleanField(default=True, verbose_name='是否有测评须知')
    need_to_know_content = models.TextField(max_length=1000, verbose_name='测评须知内容')
    is_bookable = models.BooleanField(default=True, verbose_name='是否可预订时间')
    order_number = models.IntegerField(default=0, verbose_name='排序号')

    start_time = models.DateTimeField(default=datetime.now, verbose_name='测评开始时间')
    end_time = models.DateTimeField(default=datetime.now, verbose_name='测评结束时间')
    created_by = models.ForeignKey(User, related_name='creator_project', verbose_name=u'创建者', on_delete=models.CASCADE)
    modified_by = models.ForeignKey(User, related_name='modifier_project', verbose_name='修改者', on_delete=models.CASCADE)

    class Meta:
        verbose_name = '项目'
        verbose_name_plural = verbose_name
        app_label = 'project'
        db_table = 'project'
        # unique_together = ('user', 'goods')
